//
//  CoreImageVC.swift
//  TrySwift
//
//  Created by 奇林刘 on 2019/9/18.
//  Copyright © 2019 奇林刘. All rights reserved.
//

import UIKit

class CoreImageVC: UIViewController {
    @IBOutlet weak var imageView: UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let newImage: UIImage
        
        let url = URL(string: "http://via.placeholder.com/500x500")!
        let image = CIImage(contentsOf: url)!
        let filter = blur(radius: 5.0) >>> overlay(color: UIColor.red.withAlphaComponent(0.2)) 
        newImage = UIImage(ciImage: filter(image))
        
//        newImage = UIImage(ciImage: blur(radius: 5.0)(CIImage(image: self.imageView.image!)!))
        
        self.imageView.image = newImage
    }

}
